package lab02.test23;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
import java.util.SimpleTimeZone;

public class Test {
    public static void main(String[] args) throws ParseException {
        //19981201
        String birthday;
        Scanner scanner=new Scanner(System.in);
        //2017-11-06
        System.out.println("请输入你的生日");
        birthday =scanner.nextLine();
        System.out.println(birthday);

        SimpleDateFormat sdf =new SimpleDateFormat("yyy-mm-dd");


        //关于日期的计
        Calendar calendar=Calendar.getInstance();

        calendar .setTime(sdf.parse(birthday));
        long time1=calendar.getTimeInMillis();



        calendar.setTime(new Date(sdf.format("2017-11-02")));
        long time2 =calendar.getTimeInMillis();


        System.out.println("天数："+(time1-time2)/(24*60*60*1000));
    }

}
